package service;

public enum ClientCommand {
        exit("exit"),
        privateMessage("private"),
        changeChannel("change channel"),
        usersOnline("users online"),
        channels("channels"),
        unknown("");
        
        private String clientCommand;
        
        
        private ClientCommand (final String string) {
                this.clientCommand = string; 
        }
        
        public String toString() { 
                return this.clientCommand; 
        }
        
        static public ClientCommand getType(String type) {
                String[] enterredCommand = type.split("/");
                
        for (ClientCommand command: ClientCommand.values()) {
                if (enterredCommand[1].startsWith(command.toString())){
                return command;
            }
        }
        return unknown;
    }

        static public boolean isCommand(String command){
                return command.startsWith("/");
        }
}